Main ----- Copyright Up Previous Next

Get size of images

Several browsers support the attributes WIDTH and HEIGHT for tags like <IMG>. If you know the exact size of your image, you can tell it the browser. This might speed up the layout-engine, because the browser doesn't have to wait for the image to be transfered or needs to re-layout the page after the transfer.

Usage

As you usually don't know the exact size of your images, let your stupid computer handle that tricky task by enabling the switch GETSIZE when invoking hsc. This will hsc tell to analyse the image the attribute SRC refers to, and append the attributes WIDTH and HEIGHT with the dimensions obtained from the image data.

If you have already set those attributes yourself, hsc will only validate the values, and warn about mismatches.

Supported image formats are GIF, JFIF/JPEG and PNG.

Example

Take a look at this nice picture of some nice guy: Picture of some nice guy

This can usually be included in a document using
    <IMG SRC="image/niceguy.gif" ALT="Picture of some nice guy">
but if a document called niceguy.hsc is converted using
    hsc niceguy.hsc TO niceguy.html GETSIZE
the <IMG>-tag seen above will be extended to
    <IMG SRC="image/niceguy.gif" ALT="Picture of some nice guy" WIDTH="64" HEIGHT="64">
in the html-object. If you do not like the double quotes assigned to the size values, use the CLI-option QUOTESTYLE to change this behavior.